<?php
use common\helper\StringHelper;
use services\models\OrderInfoDetail;
    $this->title = '有试吗-有事没事来试试';
    $controid = Yii::$app->controller->id;
?>
<!--加载样式-->
<?php $this->beginBlock('css');?>
    <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="<?=Yii::getAlias('@static')?>/wap/liketry/css/user.css">
<?php $this->endBlock();?>


    <header>
      <div class="header-left" onclick="history.go(-1)"><span class="icon icon-arrow-left"></span></div>
      <h1>商品清单</h1>
      <div class="header-right" onclick="$.go('<?=Yii::$app->urlManager->createUrl(['index'])?>');" ><span class="icon icon-home"></span></div>
    </header>
<ul class="user-order order-goods">
    <!--订单列表循环 Start-->
    <?php if(count($orderGoods['data'])> 0):?>
        <?php foreach($orderGoods['data'] as $key=>$val) :?>
        <li><a href="<?=Yii::$app->urlManager->createUrl(['goods-detail/index','product_id'=>$val['product_id']]);?>">
        <div class="goods-img">
            <img src="<?php if($val['goodPic']['pic'] !='') :?><?=Yii::$app->params['goods_image_url'].str_replace('./upload', 'upload', $val['goodPic']['pic'])?> <?php endif;?>" />
        </div>
        </a>
        <div class="goods-detail">
            <a href="<?=Yii::$app->urlManager->createUrl(['goods-detail/index','product_id'=>$val['product_id']]);?>">
            <h2><?php echo StringHelper::subtext($val['goodPic']['goods_name'],22);?></h2>
            <h3><?=$val['products']['spec_desc']?></h3>
            <?php if($val['buy_price'] !=0):?>
                <p>试用价：<!--试用豆没有-->
                <span class="num">¥ <?=Yii::$app->formatter->asDecimal($val['buy_price'],2)?></span>X<?=$val['buy_number']?>
            </p>
                <?php endif;?>
                <?php if($val['try_coin'] !=0):?>
            <p>试&nbsp;&nbsp;&nbsp;豆：<!--试用豆没有-->
                <span class="num">¥ <?=$val['try_coin']?></span>X<?=$val['buy_number']?>
            </p>
                <?php endif;?>
            </a>
            <div class="btn">
                <?php if(OrderInfoDetail::$STATUS_ORDER_OK == $orderInfo->status):?>
                    <?php if ($orderGoods['flg'] == OrderInfoDetail::$STATUS_COMMENT_NO): ?>
                        <a class="re_comreive">发表评论</a>
                    <?php endif; ?>

                <?php endif;?>
            </div>
        </div>
        </li>
        <?php endforeach ;?>
    <?php endif;?>
    <!--订单列表循环 End-->

</ul>

<?php $this->beginBlock('js');?>
<script src="<?=Yii::getAlias('@static')?>/wap/common/js/zepto.min.js"></script>
<script src="<?=Yii::getAlias('@static')?>/wap/common/js/fastclick.min.js"></script>
<script src="<?=Yii::getAlias('@static')?>/wap/common/js/king.wap.js"></script>
<script type="text/javascript">
    $(document).on('click','.re_comreive',function() {
        $.alert("微信端暂不支持评论，前去PC端评论可获100试豆奖励")
    })
</script>
<?php $this->endBlock();?>
